﻿using DTO;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DAO
{
    public class VTCauThu_DAO
    {
        //Lấy danh sách cầu thủ
        static public DataTable SelectAll()
        {
            string sql = "select * from VITRICAUTHU";
            return DataAccess.executeQuery(sql);
        }
        public static VTCauThu_DTO SelectByID(string id)
        {
            string sql = "select * from VITRICAUTHU where MaVT = '" + id + "'";
            DataTable dt = DataAccess.executeQuery(sql);
            VTCauThu_DTO dto = new VTCauThu_DTO();
            dto.MaVT = Convert.ToString(dt.Rows[0]["MaVT"]);
            dto.TenVT = Convert.ToString(dt.Rows[0]["TenVT"]);
            return dto;
        }
        
        public static void Insert(VTCauThu_DTO dto)
        {
            string sql = "Insert INTO VITRICAUTHU (MaVT, TenVT) VALUES ('" +
                                dto.MaVT +
                                "','" + dto.TenVT +"')";

            DataAccess.executeNonQuery(sql);
        }

        public static void Update(CauThu_DTO dto)
        {
            string sql = "Update VITRICAUTHU set ";
            DataAccess.executeNonQuery(sql);
        }
        public static void Delete(string ma)
        {
            string sql = "Delete from VITRICAUTHU where MaVT = '" + ma + "'";
            DataAccess.executeNonQuery(sql);
        }
    }
}
